package to.ax.games.card;

import org.junit.Test;

import junit.framework.TestCase;
import static to.ax.games.card.PlayingCard.*;
import static to.ax.games.card.Rank.*;
import static to.ax.games.card.Suit.*;
import static to.ax.games.card.Suit.Color.*;

/**
 * @author Tom Ritchford (tom@swirly.com)
 *
 */
public class PlayingCardTest extends TestCase {
  @Test
  public void testColors() {
    assertEquals(CLUB.color(), BLACK); 
    assertEquals(SPADE.color(), BLACK); 
    assertEquals(HEART.color(), RED); 
    assertEquals(DIAMOND.color(), RED);
  }

  @Test
  public void testRanksAndSuits() {
    // M-x praise-emacs
    assertEquals(TWO_OF_CLUBS.suit(), CLUB); 
    assertEquals(TWO_OF_CLUBS.rank(), TWO); 
    assertEquals(TWO_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(TWO_OF_DIAMONDS.rank(), TWO); 
    assertEquals(TWO_OF_HEARTS.suit(), HEART); 
    assertEquals(TWO_OF_HEARTS.rank(), TWO); 
    assertEquals(TWO_OF_SPADES.suit(), SPADE); 
    assertEquals(TWO_OF_SPADES.rank(), TWO); 
    assertEquals(THREE_OF_CLUBS.suit(), CLUB); 
    assertEquals(THREE_OF_CLUBS.rank(), THREE); 
    assertEquals(THREE_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(THREE_OF_DIAMONDS.rank(), THREE); 
    assertEquals(THREE_OF_HEARTS.suit(), HEART); 
    assertEquals(THREE_OF_HEARTS.rank(), THREE); 
    assertEquals(THREE_OF_SPADES.suit(), SPADE); 
    assertEquals(THREE_OF_SPADES.rank(), THREE); 
    assertEquals(FOUR_OF_CLUBS.suit(), CLUB); 
    assertEquals(FOUR_OF_CLUBS.rank(), FOUR); 
    assertEquals(FOUR_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(FOUR_OF_DIAMONDS.rank(), FOUR); 
    assertEquals(FOUR_OF_HEARTS.suit(), HEART); 
    assertEquals(FOUR_OF_HEARTS.rank(), FOUR); 
    assertEquals(FOUR_OF_SPADES.suit(), SPADE); 
    assertEquals(FOUR_OF_SPADES.rank(), FOUR); 
    assertEquals(FIVE_OF_CLUBS.suit(), CLUB); 
    assertEquals(FIVE_OF_CLUBS.rank(), FIVE); 
    assertEquals(FIVE_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(FIVE_OF_DIAMONDS.rank(), FIVE); 
    assertEquals(FIVE_OF_HEARTS.suit(), HEART); 
    assertEquals(FIVE_OF_HEARTS.rank(), FIVE); 
    assertEquals(FIVE_OF_SPADES.suit(), SPADE); 
    assertEquals(FIVE_OF_SPADES.rank(), FIVE); 
    assertEquals(SIX_OF_CLUBS.suit(), CLUB); 
    assertEquals(SIX_OF_CLUBS.rank(), SIX); 
    assertEquals(SIX_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(SIX_OF_DIAMONDS.rank(), SIX); 
    assertEquals(SIX_OF_HEARTS.suit(), HEART); 
    assertEquals(SIX_OF_HEARTS.rank(), SIX); 
    assertEquals(SIX_OF_SPADES.suit(), SPADE); 
    assertEquals(SIX_OF_SPADES.rank(), SIX); 
    assertEquals(SEVEN_OF_CLUBS.suit(), CLUB); 
    assertEquals(SEVEN_OF_CLUBS.rank(), SEVEN); 
    assertEquals(SEVEN_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(SEVEN_OF_DIAMONDS.rank(), SEVEN); 
    assertEquals(SEVEN_OF_HEARTS.suit(), HEART); 
    assertEquals(SEVEN_OF_HEARTS.rank(), SEVEN); 
    assertEquals(SEVEN_OF_SPADES.suit(), SPADE); 
    assertEquals(SEVEN_OF_SPADES.rank(), SEVEN); 
    assertEquals(EIGHT_OF_CLUBS.suit(), CLUB); 
    assertEquals(EIGHT_OF_CLUBS.rank(), EIGHT); 
    assertEquals(EIGHT_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(EIGHT_OF_DIAMONDS.rank(), EIGHT); 
    assertEquals(EIGHT_OF_HEARTS.suit(), HEART); 
    assertEquals(EIGHT_OF_HEARTS.rank(), EIGHT); 
    assertEquals(EIGHT_OF_SPADES.suit(), SPADE); 
    assertEquals(EIGHT_OF_SPADES.rank(), EIGHT); 
    assertEquals(NINE_OF_CLUBS.suit(), CLUB); 
    assertEquals(NINE_OF_CLUBS.rank(), NINE); 
    assertEquals(NINE_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(NINE_OF_DIAMONDS.rank(), NINE); 
    assertEquals(NINE_OF_HEARTS.suit(), HEART); 
    assertEquals(NINE_OF_HEARTS.rank(), NINE); 
    assertEquals(NINE_OF_SPADES.suit(), SPADE); 
    assertEquals(NINE_OF_SPADES.rank(), NINE); 
    assertEquals(TEN_OF_CLUBS.suit(), CLUB); 
    assertEquals(TEN_OF_CLUBS.rank(), TEN); 
    assertEquals(TEN_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(TEN_OF_DIAMONDS.rank(), TEN); 
    assertEquals(TEN_OF_HEARTS.suit(), HEART); 
    assertEquals(TEN_OF_HEARTS.rank(), TEN); 
    assertEquals(TEN_OF_SPADES.suit(), SPADE); 
    assertEquals(TEN_OF_SPADES.rank(), TEN); 
    assertEquals(JACK_OF_CLUBS.suit(), CLUB); 
    assertEquals(JACK_OF_CLUBS.rank(), JACK); 
    assertEquals(JACK_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(JACK_OF_DIAMONDS.rank(), JACK); 
    assertEquals(JACK_OF_HEARTS.suit(), HEART); 
    assertEquals(JACK_OF_HEARTS.rank(), JACK); 
    assertEquals(JACK_OF_SPADES.suit(), SPADE); 
    assertEquals(JACK_OF_SPADES.rank(), JACK); 
    assertEquals(QUEEN_OF_CLUBS.suit(), CLUB); 
    assertEquals(QUEEN_OF_CLUBS.rank(), QUEEN); 
    assertEquals(QUEEN_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(QUEEN_OF_DIAMONDS.rank(), QUEEN); 
    assertEquals(QUEEN_OF_HEARTS.suit(), HEART); 
    assertEquals(QUEEN_OF_HEARTS.rank(), QUEEN); 
    assertEquals(QUEEN_OF_SPADES.suit(), SPADE); 
    assertEquals(QUEEN_OF_SPADES.rank(), QUEEN); 
    assertEquals(KING_OF_CLUBS.suit(), CLUB); 
    assertEquals(KING_OF_CLUBS.rank(), KING); 
    assertEquals(KING_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(KING_OF_DIAMONDS.rank(), KING); 
    assertEquals(KING_OF_HEARTS.suit(), HEART); 
    assertEquals(KING_OF_HEARTS.rank(), KING); 
    assertEquals(KING_OF_SPADES.suit(), SPADE); 
    assertEquals(KING_OF_SPADES.rank(), KING); 
    assertEquals(ACE_OF_CLUBS.suit(), CLUB); 
    assertEquals(ACE_OF_CLUBS.rank(), ACE); 
    assertEquals(ACE_OF_DIAMONDS.suit(), DIAMOND); 
    assertEquals(ACE_OF_DIAMONDS.rank(), ACE); 
    assertEquals(ACE_OF_HEARTS.suit(), HEART); 
    assertEquals(ACE_OF_HEARTS.rank(), ACE); 
    assertEquals(ACE_OF_SPADES.suit(), SPADE); 
    assertEquals(ACE_OF_SPADES.rank(), ACE); 
  }

  @Test
  public void testOf() {
    assertEquals(TWO.of(CLUB),TWO_OF_CLUBS);             
    assertEquals(CLUB.of(TWO), TWO_OF_CLUBS);             
    assertEquals(TWO.of(DIAMOND),TWO_OF_DIAMONDS);       
    assertEquals(DIAMOND.of(TWO), TWO_OF_DIAMONDS);       
    assertEquals(TWO.of(HEART),TWO_OF_HEARTS);           
    assertEquals(HEART.of(TWO), TWO_OF_HEARTS);           
    assertEquals(TWO.of(SPADE),TWO_OF_SPADES);           
    assertEquals(SPADE.of(TWO), TWO_OF_SPADES);           
    assertEquals(THREE.of(CLUB),THREE_OF_CLUBS);         
    assertEquals(CLUB.of(THREE), THREE_OF_CLUBS);         
    assertEquals(THREE.of(DIAMOND),THREE_OF_DIAMONDS);   
    assertEquals(DIAMOND.of(THREE), THREE_OF_DIAMONDS);   
    assertEquals(THREE.of(HEART),THREE_OF_HEARTS);       
    assertEquals(HEART.of(THREE), THREE_OF_HEARTS);       
    assertEquals(THREE.of(SPADE),THREE_OF_SPADES);       
    assertEquals(SPADE.of(THREE), THREE_OF_SPADES);       
    assertEquals(FOUR.of(CLUB),FOUR_OF_CLUBS);           
    assertEquals(CLUB.of(FOUR), FOUR_OF_CLUBS);           
    assertEquals(FOUR.of(DIAMOND),FOUR_OF_DIAMONDS);     
    assertEquals(DIAMOND.of(FOUR), FOUR_OF_DIAMONDS);     
    assertEquals(FOUR.of(HEART),FOUR_OF_HEARTS);         
    assertEquals(HEART.of(FOUR), FOUR_OF_HEARTS);         
    assertEquals(FOUR.of(SPADE),FOUR_OF_SPADES);         
    assertEquals(SPADE.of(FOUR), FOUR_OF_SPADES);         
    assertEquals(FIVE.of(CLUB),FIVE_OF_CLUBS);           
    assertEquals(CLUB.of(FIVE), FIVE_OF_CLUBS);           
    assertEquals(FIVE.of(DIAMOND),FIVE_OF_DIAMONDS);     
    assertEquals(DIAMOND.of(FIVE), FIVE_OF_DIAMONDS);     
    assertEquals(FIVE.of(HEART),FIVE_OF_HEARTS);         
    assertEquals(HEART.of(FIVE), FIVE_OF_HEARTS);         
    assertEquals(FIVE.of(SPADE),FIVE_OF_SPADES);         
    assertEquals(SPADE.of(FIVE), FIVE_OF_SPADES);         
    assertEquals(SIX.of(CLUB),SIX_OF_CLUBS);             
    assertEquals(CLUB.of(SIX), SIX_OF_CLUBS);             
    assertEquals(SIX.of(DIAMOND),SIX_OF_DIAMONDS);       
    assertEquals(DIAMOND.of(SIX), SIX_OF_DIAMONDS);       
    assertEquals(SIX.of(HEART),SIX_OF_HEARTS);           
    assertEquals(HEART.of(SIX), SIX_OF_HEARTS);           
    assertEquals(SIX.of(SPADE),SIX_OF_SPADES);           
    assertEquals(SPADE.of(SIX), SIX_OF_SPADES);           
    assertEquals(SEVEN.of(CLUB),SEVEN_OF_CLUBS);         
    assertEquals(CLUB.of(SEVEN), SEVEN_OF_CLUBS);         
    assertEquals(SEVEN.of(DIAMOND),SEVEN_OF_DIAMONDS);   
    assertEquals(DIAMOND.of(SEVEN), SEVEN_OF_DIAMONDS);   
    assertEquals(SEVEN.of(HEART),SEVEN_OF_HEARTS);       
    assertEquals(HEART.of(SEVEN), SEVEN_OF_HEARTS);       
    assertEquals(SEVEN.of(SPADE),SEVEN_OF_SPADES);       
    assertEquals(SPADE.of(SEVEN), SEVEN_OF_SPADES);       
    assertEquals(EIGHT.of(CLUB),EIGHT_OF_CLUBS);         
    assertEquals(CLUB.of(EIGHT), EIGHT_OF_CLUBS);         
    assertEquals(EIGHT.of(DIAMOND),EIGHT_OF_DIAMONDS);   
    assertEquals(DIAMOND.of(EIGHT), EIGHT_OF_DIAMONDS);   
    assertEquals(EIGHT.of(HEART),EIGHT_OF_HEARTS);       
    assertEquals(HEART.of(EIGHT), EIGHT_OF_HEARTS);       
    assertEquals(EIGHT.of(SPADE),EIGHT_OF_SPADES);       
    assertEquals(SPADE.of(EIGHT), EIGHT_OF_SPADES);       
    assertEquals(NINE.of(CLUB),NINE_OF_CLUBS);           
    assertEquals(CLUB.of(NINE), NINE_OF_CLUBS);           
    assertEquals(NINE.of(DIAMOND),NINE_OF_DIAMONDS);     
    assertEquals(DIAMOND.of(NINE), NINE_OF_DIAMONDS);     
    assertEquals(NINE.of(HEART),NINE_OF_HEARTS);         
    assertEquals(HEART.of(NINE), NINE_OF_HEARTS);         
    assertEquals(NINE.of(SPADE),NINE_OF_SPADES);         
    assertEquals(SPADE.of(NINE), NINE_OF_SPADES);         
    assertEquals(TEN.of(CLUB),TEN_OF_CLUBS);             
    assertEquals(CLUB.of(TEN), TEN_OF_CLUBS);             
    assertEquals(TEN.of(DIAMOND),TEN_OF_DIAMONDS);       
    assertEquals(DIAMOND.of(TEN), TEN_OF_DIAMONDS);       
    assertEquals(TEN.of(HEART),TEN_OF_HEARTS);           
    assertEquals(HEART.of(TEN), TEN_OF_HEARTS);           
    assertEquals(TEN.of(SPADE),TEN_OF_SPADES);           
    assertEquals(SPADE.of(TEN), TEN_OF_SPADES);           
    assertEquals(JACK.of(CLUB),JACK_OF_CLUBS);           
    assertEquals(CLUB.of(JACK), JACK_OF_CLUBS);           
    assertEquals(JACK.of(DIAMOND),JACK_OF_DIAMONDS);     
    assertEquals(DIAMOND.of(JACK), JACK_OF_DIAMONDS);     
    assertEquals(JACK.of(HEART),JACK_OF_HEARTS);         
    assertEquals(HEART.of(JACK), JACK_OF_HEARTS);         
    assertEquals(JACK.of(SPADE),JACK_OF_SPADES);         
    assertEquals(SPADE.of(JACK), JACK_OF_SPADES);         
    assertEquals(QUEEN.of(CLUB),QUEEN_OF_CLUBS);         
    assertEquals(CLUB.of(QUEEN), QUEEN_OF_CLUBS);         
    assertEquals(QUEEN.of(DIAMOND),QUEEN_OF_DIAMONDS);   
    assertEquals(DIAMOND.of(QUEEN), QUEEN_OF_DIAMONDS);   
    assertEquals(QUEEN.of(DIAMOND),QUEEN_OF_DIAMONDS);   
    assertEquals(DIAMOND.of(QUEEN), QUEEN_OF_DIAMONDS);   
    assertEquals(QUEEN.of(HEART),QUEEN_OF_HEARTS);       
    assertEquals(HEART.of(QUEEN), QUEEN_OF_HEARTS);       
    assertEquals(QUEEN.of(SPADE),QUEEN_OF_SPADES);       
    assertEquals(SPADE.of(QUEEN), QUEEN_OF_SPADES);       
    assertEquals(KING.of(CLUB),KING_OF_CLUBS);           
    assertEquals(CLUB.of(KING), KING_OF_CLUBS);           
    assertEquals(KING.of(DIAMOND),KING_OF_DIAMONDS);     
    assertEquals(DIAMOND.of(KING), KING_OF_DIAMONDS);     
    assertEquals(KING.of(HEART),KING_OF_HEARTS);         
    assertEquals(HEART.of(KING), KING_OF_HEARTS);         
    assertEquals(KING.of(SPADE),KING_OF_SPADES);         
    assertEquals(SPADE.of(KING), KING_OF_SPADES);         
    assertEquals(ACE.of(CLUB),ACE_OF_CLUBS);             
    assertEquals(CLUB.of(ACE), ACE_OF_CLUBS);             
    assertEquals(ACE.of(DIAMOND),ACE_OF_DIAMONDS);       
    assertEquals(DIAMOND.of(ACE), ACE_OF_DIAMONDS);       
    assertEquals(ACE.of(HEART),ACE_OF_HEARTS);           
    assertEquals(HEART.of(ACE), ACE_OF_HEARTS);           
    assertEquals(ACE.of(SPADE),ACE_OF_SPADES);           
    assertEquals(SPADE.of(ACE), ACE_OF_SPADES);           
    
  }
}
